//k1 edit 21.12.18

private ["_center","_rotation","_obj","_staticWeaponClasses","_parkedVehicleClasses"];
_center = param[0];
_rotation = param[1];

_staticWeaponClasses = if(count _this > 2)then [{_this select 2},{[]}];
_parkedVehicleClasses = if(count _this > 3)then[{_this select 3},{[]}];

if (isNil "a3e_var_artillery_units") then {a3e_var_artillery_units = []};

[_center,40] call a3e_fnc_cleanupTerrain;

_fnc_createObject = {
    params ["_className","_centerPos","_relativePos","_rotateDir","_relativeDir"];
    private ["_object", "_realPos", "_realDir"];

    _fnc_rotatePos = {
        private ["_centerPos", "_pos", "_dir"];
        private ["_px", "_py", "_mpx", "_mpy", "_ma", "_rpx", "_rpy"];
        _centerPos = _this select 0;
        _pos = _this select 1;
        _dir = _this select 2;
        _px = _pos select 0;
        _py = _pos select 1;
        _mpx = _centerPos select 0;
        _mpy = _centerPos select 1;
        _ma = _dir;
        _rpx = ( (_px - _mpx) * cos(_ma) ) + ( (_py - _mpy) * sin(_ma) ) + _mpx;
        _rpy = (-(_px - _mpx) * sin(_ma) ) + ( (_py - _mpy) * cos(_ma) ) + _mpy;
        [_rpx, _rpy, (_pos select 2)];
    };

    _realPos = ([_centerPos, [(_centerPos select 0) + (_relativePos select 0), (_centerPos select 1) + (_relativePos select 1),(_relativePos select 2)], _rotateDir] call _fnc_rotatePos);
    _object = createVehicle [_className, _realPos, [], 0, "CAN_COLLIDE"];
    _object setdir (_relativeDir + _rotateDir);
    _object setPosATL _realPos;
    _object
};

_obj = objNull;
_obj = ["Land_Razorwire_F",_center,[-16.7319,-20.8667,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-22.3569,-17.4917,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-22.6069,15.1333,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-22.4819,-1.1167,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-22.4819,7.0083,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-17.4819,26.2583,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-22.6069,23.2583,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[15.1431,26.3833,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-9.35693,26.2583,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[6.89307,26.3833,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[-1.23193,26.3833,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[15.7681,-20.2417,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[21.0181,-16.8667,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[21.0181,-8.7417,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[20.8931,14.8833,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[20.8931,-1.7417,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[20.8931,6.3833,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_Razorwire_F",_center,[20.8931,23.0083,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-18.9819,-14.3667,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-17.1069,-17.3667,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-19.2319,18.8833,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-19.1069,2.2583,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-19.1069,10.5083,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-18.9819,-6.1167,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-17.3569,22.2583,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-8.73193,-17.2417,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[7.64307,-16.9917,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-9.10693,22.5083,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[7.39307,22.7583,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[-0.856934,22.6333,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[17.7681,-13.4917,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[17.7,-5.2,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[15.8931,-16.7417,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[17.5181,11.5083,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[17.6431,3.1333,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[17.5181,19.7583,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_HBarrierWall6_F",_center,[15.6431,22.8833,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-10.625,10.125,0],_rotation,270] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-1,13.75,3.47],_rotation,0] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-3.75,16.375,3.47],_rotation,90] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-13.25,7.5,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[1.625,16.375,3.47],_rotation,270] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-16,10.125,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-13.25,12.75,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_BagFence_Round_F",_center,[-1,19,3.47],_rotation,180] call _fnc_createObject;
_obj = ["Land_BagBunker_Small_F",_center,[-18.11,20.63,4.21],_rotation,135] call _fnc_createObject;
_obj = ["Land_BagBunker_Small_F",_center,[15.393,20.88,4.21],_rotation,225] call _fnc_createObject;
_obj = ["Land_HBarrierTower_F",_center,[-16.982,19.88,0],_rotation,135] call _fnc_createObject;
_obj = ["Land_HBarrierTower_F",_center,[14.893,20.51,0],_rotation,225] call _fnc_createObject;
_obj = ["Land_BagBunker_Tower_F",_center,[-7.61,-21.37,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_BagBunker_Tower_F",_center,[6.39,-21.12,0],_rotation,0] call _fnc_createObject;
_obj = ["Land_Cargo_House_V1_F",_center,[12.632,10.2,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_Cargo_House_V1_F",_center,[12.743,2.2,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_Cargo_HQ_V1_F",_center,[10.4,-7.26,0],_rotation,90] call _fnc_createObject;
_obj = ["Land_Bunker_01_HQ_F",_center,[-1,16.06,0.13],_rotation,270] call _fnc_createObject;
_obj = ["Land_BarGate_F",_center,[-0.11,-28.74,0],_rotation,180] call _fnc_createObject;
_obj = ["Land_Communication_F",_center,[16.14,-15.242,0],_rotation,0] call _fnc_createObject;

_obj = ["CamoNet_BLUFOR_big_F",_center,[-14.75,-5,0],_rotation,270] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Land_DataTerminal_01_F",_center,[-1.5,16.52,0.26],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj setVariable ["A3E_isTerminal",true,true];
[_obj,"green","green","green"] call BIS_fnc_DataTerminalColor;

_obj = ["Box_CSAT_Equip_F",_center,[-1.73,15.62,0.26],_rotation,270] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Box_East_Ammo_F",_center,[15.9,-12,1],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Box_East_WpsLaunch_F",_center,[15.88,-10.45,1],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Box_East_Wps_F",_center,[15.82,-13.55,1],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Box_East_WpsSpecial_F",_center,[15.78,10.084,1],_rotation,180] call _fnc_createObject;
_obj allowDamage false;
_obj = ["Box_East_WpsSpecial_F",_center,[15.88,2.084,1],_rotation,180] call _fnc_createObject;
_obj allowDamage false;

//Statics
_MGGMH = a3e_arr_Escape_SWC_MG_H + a3e_arr_Escape_SWC_GM_H;
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-18.348,21.19,2.267],_rotation,315] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[6.46,-22.68,0],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-7.86,-23.12,0],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[16.215,21.84,2.27],_rotation,45] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-18.39,20.86,4.2],_rotation,315] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[15.42,-13.16,3.1],_rotation,135] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[-7.86,-23.24,2.77],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[6,-23,2.77],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[15.445,20.78,4.2],_rotation,45] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[5.44,-6.25,3.11],_rotation,270] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom _MGGMH;
_obj = [_gun,_center,[13.145,-4.51,3.11],_rotation,45] call _fnc_createObject;
Escape_allStatics pushback _obj;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_MGGMA = a3e_arr_Escape_SWC_MG_A + a3e_arr_Escape_SWC_GM_A;
_gun = selectRandom _MGGMA;
_obj = [_gun,_center,[6.342,-19.25,2.86],_rotation,90] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom _MGGMA;
_obj = [_gun,_center,[-7.63,-19.5,2.86],_rotation,270] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom a3e_arr_Escape_SWC_MG_A;
_obj = [_gun,_center,[-15.71,-11.02,0.1],_rotation,110] call _fnc_createObject;
Escape_allStatics pushback _obj;
_gun = selectRandom a3e_arr_Escape_SWC_MG_A;
_obj = [_gun,_center,[-1.217,9.05,0.1],_rotation,180] call _fnc_createObject;
Escape_allStatics pushback _obj;

_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[-18.34,20.65,6.21],_rotation,315] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[-7.64,-23,4.9],_rotation,225] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[6.143,-22.74,4.91],_rotation,135] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AT;
_obj = [_gun,_center,[15.48,21.25,6.2],_rotation,45] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[1.5,13.25,3.6],_rotation,135] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[-3.75,13.5,3.6],_rotation,225] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[-3.75,18.5,3.6],_rotation,315] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_Escape_SWC_launcher_AA;
_obj = [_gun,_center,[1.5,18.75,3.6],_rotation,45] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

_gun = selectRandom a3e_arr_MortarSite; //
_obj = [_gun,_center,[-1.25,16.25,3.6],_rotation,90] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];
_gun = selectRandom a3e_arr_MortarSite; //
_obj = [_gun,_center,[-13.36,9.87,0],_rotation,90] call _fnc_createObject;
[_obj,A3E_VAR_Side_Opfor] spawn A3E_fnc_AddStaticGunner;
Escape_all_assets pushback _obj;
a3e_var_artillery_units pushBack _obj;
_obj setVariable ["Escape_assets_control", true, true];

//veh
_vehicle = selectRandom _parkedVehicleClasses;
_obj = [_vehicle,_center,[-12,-7.25,0],_rotation,90] call _fnc_createObject;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];
_vehicle = selectRandom _parkedVehicleClasses;
_obj = [_vehicle,_center,[-12.48,-1,0],_rotation,90] call _fnc_createObject;
Escape_all_assets pushback _obj;
_obj setVariable ["Escape_assets_control", true, true];

Escape_campType_arr pushback [_center,"信号站","Jade"];
publicVariable "Escape_campType_arr";


